package reflect;

import java.util.Arrays;

/**
 * JDK5之后,Java提供了一种特性
 */
public class ArgDemo {
    public static void main(String[] args) {
        doSome();
        doSome("a");
        doSome("a","b");
        doSome("a","b","c");
        doSome("a","b","c","d");
        doSome("a","b","c","d","e");
        doSome("a","b","c","d","e","f");
        doSome("a","b","c","d","e","f","g");
        doSome("a","b","c","d","e","f","g","h");
    }
    /*
     编译器会将变长参数改为数组
     public static void doSome(String[] arg){

     变长参数有一个要求:它必须是方法的最后一个参数
     public static void doSome(int a,String... arg){
  */
    public static void doSome(String... arg){
        System.out.println(arg.length);
        System.out.println(Arrays.toString(arg));
    }
}